home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / vector.lha / vector / stack.h < prev    next >
C/C++ Source or Header  |  1991-11-23  |  862b  |  32 lines

  1. #ifndef _STACK_H
  2. #define _STACK_H
  3.  
  4. #include <hmatrix.h>
  5.  
  6. const int MatrixStackDepth = 20;
  7.  
  8. class MatrixStack {
  9.     HMatrix stack[MatrixStackDepth];// Stack of suspended matrices
  10.     HMatrix tos;            // Current matrix
  11.     HMatrix tosadjoint;            // Adjoint of current matrix, if computed
  12.     float   tosdeterminant;        // Determinant of current matrix, if computed
  13.     int     depth;            // # of matrices on stack
  14.     int     adjointflag;        // Is adjoint computed for CTM?
  15.  
  16.     void    compute_adjoint();        // Recompute adjoint, determinant
  17.  
  18. public:
  19.     void init() { tos.identity(); depth = 0; adjointflag = 0; }
  20.  
  21.     MatrixStack() { init(); }
  22.     MatrixStack(HMatrix &m) : tos(m) { depth = 0; adjointflag = 0; }
  23.  
  24.     HMatrix &ctm() { return tos; }
  25.     HMatrix &ctmadjoint();
  26.     float    ctmdet();
  27.     int push();
  28.     int pop();
  29. };
  30.  
  31. #endif /*_STACK_H*/
  32.